package com.hiray.restcache.api

import com.hiray.restcache.api.res.IndexActivityBody
import com.hiray.restcache.api.res.IndexData
import com.hiray.restcache.api.res.LoginRequest
import com.hiray.restcache.api.res.LoginResponseBody
import com.zmy.rxcache.Cache
import com.zmy.rxcache.Reply
import io.reactivex.Flowable
import io.reactivex.Observable
import io.reactivex.Single
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST

interface RestApi {


    @Cache(key = "userinfo", expiredTime = 5)
    @POST("member/login")
    fun login(@Body loginRequest: LoginRequest): Observable<Reply<ResponseWrapper<LoginResponseBody>>>


    @Cache(key = "home_index", expiredTime = 5)
    @POST("xingqiu/index")
    fun getIndex(): Flowable<Reply<ResponseWrapper<IndexData>>>


    @GET("xingqiu/index_act")
    @Cache(key = "index_act",expiredTime = 10)
    fun getIndexActivities(): Single<ResponseWrapper<IndexActivityBody>>
}